package com.weitu.risk.service.impl;

import com.weitu.risk.entity.MatrixResult;
import com.weitu.risk.mapper.MatrixResultMapper;
import com.weitu.risk.service.MatrixResultService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class MatrixResultServiceImpl implements MatrixResultService {
    @Autowired
    private MatrixResultMapper matrixResultMapper;

    @Override
    public List<MatrixResult> queryListByParam(Map<String, Object> map) {
        return this.matrixResultMapper.queryListByParam(map);
    }

    @Override
    public MatrixResult queryResultById(@Param("id") String id) {
        return this.matrixResultMapper.queryResultById(id);
    }

    @Override
    public boolean addResult(Map<String, Object> map) {
        int result = this.matrixResultMapper.insertResult(map);
        if(result<1){
            return false;
        }
        return true;
    }

    @Override
    public boolean editResult(Map<String, Object> map) {
        int result = this.matrixResultMapper.updateResult(map);
        if(result<1){
            return false;
        }
        return true;
    }

    @Override
    public boolean deleteResult(@Param("id") String id) {
        int result = this.matrixResultMapper.deleteResult(id);
        if(result<1){
            return false;
        }
        return true;
    }
}